#ifndef ASSIMPMESHEXPORTER_H
#define ASSIMPMESHEXPORTER_H
// AssImpMesh.h
#pragma once

// 添加必要的包含
#include <cstddef> // 用于 size_t

// 在包含assimp头文件之前添加这些定义
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wignored-attributes"
#endif

// 只在尚未定义的情况下定义这些操作符
#ifndef ASSIMP_CUSTOM_OPERATORS_DEFINED
#define ASSIMP_CUSTOM_OPERATORS_DEFINED

// 检查标准库是否已经定义了placement new
#ifndef __GLIBCXX__
inline void* operator new(std::size_t, void* ptr) noexcept {
    return ptr;
}
#endif

// 检查标准库是否已经定义了placement delete
#ifndef __GLIBCXX__
inline void operator delete(void*, void*) noexcept {
}
#endif

#endif // ASSIMP_CUSTOM_OPERATORS_DEFINED

#ifdef __clang__
#pragma clang diagnostic pop
#endif

// 然后包含assimp头文件
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <assimp/postprocess.h>
#include <QObject>

#include <assimp/vector3.h>
#include <assimp/mesh.h>
#include <assimp/scene.h>

class AssImpMesh;
class AssImpMeshExporter : public QObject
{
    Q_OBJECT
public:
    explicit AssImpMeshExporter(QObject *parent = nullptr);


    aiReturn exportMeshes(const std::vector<AssImpMesh*>& meshes, const std::string& exportPath);
signals:


private:
    aiMesh* createMesh(const std::vector<aiVector3D>& vertices,
                       const std::vector<unsigned int>& indices,
                       const std::vector<aiVector3D>& normals,
                       const std::vector<aiVector3D>& texCoords);

    aiScene* createScene(const std::vector<aiMesh*>& meshes);

};

#endif // ASSIMPMESHEXPORTER_H
